// login_beta.java
// This program finds your GPA. (8 periods)
// Login credentials (both are case sensitive):
// username: tgaubert, admin (opens admin panel)
// password: password (unless changed)
// -----------------------------
// Login will quit program if incorrect user/pass is entered.
// -----------------------------


public class login_beta2
{
	public static void main (String args[])
	{
		String pass = "asgeasdgnslkegbest";
		boolean finished = false;
		do
		// Log in
		{
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println();
		System.out.println("ATTENTION: THIS IS A BETA VERSION. USE STABLE VERSION UNLESS TESTING BETA. KNOWN ISSUES: *ADMIN PANEL CHOICE DOESN'T WORK");
		System.out.println();
		System.out.println();
		while (pass != "password")
		{
			System.out.println();
			System.out.print("Password: ");
			pass = Expo.enterString();
			if (pass != "password")
				System.out.println("Incorrect Password.  Try Again.");
		}
		System.out.println("\nYou are now logged in.  Welcome to the program.");


		System.out.println("GPA Calculator v. 1.0 (BETA)");
		System.out.println("---------------");
		System.out.println("Welcome");
		System.out.println("---------------");
		System.out.println("Please log in:\n");
		String username = "tgaubert";
		String admin = "admin";
		System.out.print("Username: ");
		String s3 = Expo.enterString();
		System.out.print("Password: ");
		String s4 = Expo.enterString();
		/*
		if (s3.equals(admin))
			{
					System.out.println("\nAdmin logged in. Launch admin panel? [Y/N] ");
					String adminreply = Expo.enterString();
					String y = "y";
					if (adminreply.equals(y));
						System.out.println();
						{
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println("_________________________________________________________________");
							System.out.println("|      Admin Panel - v. 1.0 - GPA Calculator v. 1.0 (BETA)      |");
							System.out.println("-----------------------------------------------------------------");
							System.out.println("|                         COMMANDS:                             |");
							System.out.println("-----------------------------------------------------------------");
							System.out.println("| q = quit panel                     p = change global password |");
							System.out.println("-----------------------------------------------------------------");
							System.out.println("                   Current password: " + pass + "                ");
							System.out.println("-----------------------------------------------------------------");
							System.out.println();
							System.out.println("Command: ");
							String command = Expo.enterString();
							String q = "q";
							String p = "p";
								if (command.equals(q))
									System.out.println();
								else
									System.out.println();
								if (command.equals(p))
								{

									System.out.println("Changing Password - NOTE THAT THIS AFFECTS ALL USERS FOR THIS SESSION ONLY!!!");
									System.out.println("New password: ");
									pass = Expo.enterString();
								}
								else
									System.out.println();
						}
				else

				//	No "else" is needed, the admin panel will not open when "n" is entered.
			}
			*/
		if (username.equals(s3))
			System.out.println("\nUsername set to: " + s3);
		else
			System.out.println("\nUsername set to: " + s3);

			// "Dirty" clearing of screen
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			// collect grade points
			System.out.println("Let's find your GPA. Insert your grade on a scale of 0.00 to 5.00.");
			System.out.println("(GP above 4.00 is for pre-AP/AP classes only.)");
			System.out.println();
			System.out.println("Period 1: ");
         	double per1 = Expo.enterDouble();
         	System.out.println("\nPeriod 2: ");
         	double per2 = Expo.enterDouble();
         	System.out.println("\nPeriod 3: ");
         	double per3 = Expo.enterDouble();
         	System.out.println("\nPeriod 4: ");
         	double per4 = Expo.enterDouble();
         	System.out.println("\nPeriod 5: ");
         	double per5 = Expo.enterDouble();
         	System.out.println("\nPeriod 6: ");
         	double per6 = Expo.enterDouble();
         	System.out.println("\nPeriod 7: ");
         	double per7 = Expo.enterDouble();
         	System.out.println("\nPeriod 8: ");
         	double per8 = Expo.enterDouble();
         	System.out.println("\nGP's entered: " + per1 + ", " + per2 + ", " + per3 + ", " + per4 + ", " + per5 + ", " + per6 + ", " + per7 + ", " + per8);
         	// "dirty" clean screen
         	System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			System.out.println();
			// doing the math
			double total = per1 + per2 + per3 + per4 + per5 + per6 + per7 + per8;
			double gpa = total / 8;

			// display the GPA
			System.out.println(s3 + "'s GPA is: " + gpa);
			System.out.println();
			double perfect = 4;
			double fail = 2;
			// display message (congratulating user, etc.)
			System.out.println("------------------");
			System.out.println("|     Message:   |");
			System.out.println("------------------");
			if (gpa == (perfect))
			System.out.println("\nWow! Perfect score! Good job :)\n");
			else
			System.out.println();

			if (gpa < (fail))
			System.out.println("LOL you got a 0. (You should probably check your numbers.) ;P\n");
			else
			System.out.println();


			// repeat script? (y= yes, n= no)
			System.out.print("Do you wish to log out and go to log in screen [Y/N]? ");
			char repeat = Expo.enterChar();
			finished = (repeat != 'Y' && repeat != 'y');
			System.out.println();
			} while (!finished);
	}
}

/* Reimplement code when ready....
 {
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println();
							System.out.println("_________________________________________________________________");
							System.out.println("|      Admin Panel - v. 1.0 - GPA Calculator v. 1.0 (BETA)      |");
							System.out.println("-----------------------------------------------------------------");
							System.out.println("|                         COMMANDS:                             |");
							System.out.println("-----------------------------------------------------------------");
							System.out.println("| q = quit panel                     p = change global password |");
							System.out.println("-----------------------------------------------------------------");
							System.out.println("                   Current password: " + pass + "                ");
							System.out.println("-----------------------------------------------------------------");
							System.out.println();
							System.out.println("Command: ");
							String command = Expo.enterString();
							String q = "q";
							String p = "p";
								if (command.equals(q))
									System.out.println("Quitting admin panel...");
								else
									System.out.println();
								if (command.equals(p))
								{

									System.out.println("Changing Password - NOTE THAT THIS AFFECTS ALL USERS FOR THIS SESSION ONLY!!!");
									System.out.println("New password: ");
									pass = Expo.enterString();
								}
								else
									System.out.println();
*/